package com.myrpc.common;

import org.msgpack.MessagePack;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class MyMessageEncoder extends MessageToByteEncoder<Object>{
	
	final MessagePack msgpack = new MessagePack();

	@Override
	protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
		byte[] array = msgpack.write(msg);
		
		out.writeBytes(array);
	}

	
}
